#include "Point2d.h"

namespace Lame3d
{
	Point2d::Point2d(float x, float y)
	{
		coords[0] = x;
		coords[1] = y;
	}
	
	Point2d::Point2d(const Point2d &p)
	{
		for(int i=0; i<2; ++i) {
			coords[i] = p.coords[i];
		}
	}
	
	Point2d::~Point2d()
	{
	}
	
	Point2d& Point2d::operator+=(const Point2d &p)
	{
		for(int i=0; i<2; ++i) {
			coords[i] += p.coords[i];
		}
		return *this;
	}
	
	Point2d& Point2d::operator-=(const Point2d &p)
	{
		for(int i=0; i<2; ++i) {
			coords[i] -= p.coords[i];
		}
		return *this;
	}
	
	Point2d& Point2d::operator*=(float f)
	{
		for(int i=0; i<2; ++i) {
			coords[i] *= f;
		}
		return *this;
	}
	
	Point2d& Point2d::operator/=(float f)
	{
		return *this*=(1.0/f);
	}
	
	float& Point2d::operator[](int i)
	{
		return coords[i];
	}
	
	float Point2d::operator[](int i) const
	{
		return coords[i];
	}
}
